home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / lang / HeliOS4.lha / helios_demo_disk4 / docs / userinterface / Compilation.doc < prev    next >
Encoding:
Text File  |  1995-12-10  |  7.8 KB  |  186 lines

  1.  
  2. ***************************************
  3. Compiling and executing HeliOS programs
  4. ***************************************
  5.  
  6. HeliOS has a variety of compilation and execution functions.  Here we give
  7. a short overview of these functions, and more information on the compilation
  8. and execution of HelioS programs can be found in "StandAlonePrograms.doc".
  9.  
  10.  
  11. *****************************************************
  12. The HeliOS Interpreter has three modes of compilation
  13. *****************************************************
  14.  
  15. Actually it would be more true to state that HeliOS has three modes of
  16. saving, loading and running compiled HeliOS code.  The HeliOS Interpreter
  17. menus have a "compile-mode" setting which determines which of the three
  18. methods of generating compiled code files will be used.
  19.  
  20. The simplest mode of compilation is when the interpreter is used to
  21. compile code into the dictionary for immediate use in the integrated
  22. HeliOS environment.
  23.  
  24. Thus you can simply compile a program then test and run it etc.
  25.  
  26. The HeliOS Interpreter, once it has compiled some code, can then save out
  27. the code in three different ways using a menu function called "PRESAVE".
  28.  
  29. Firstly, you can save (and reload) the current status of the HeliOS system,
  30. which effectively allows you to compile, save, and reload current programs
  31. from within the HeliOS interpreter.
  32.  
  33. HeliOS also allows you to save "overlay" files which consist of a block of
  34. precompiled HeliOS code which can subsequently be run without the presence
  35. of the main Interpreter program.  These overlay programs are executed by
  36. using the separate HeliOS standalone execution program "HeliOS_exe".
  37.  
  38. Note that these modular overlays can also be generated using the standalone
  39. HeliOS compiler program "HeliOS_cmp".
  40.  
  41. The main HeliOS Interpreter can also generate true single-file stand-alone
  42. executable files.
  43.  
  44.  
  45. ***************
  46. Executable size
  47. ***************
  48.  
  49. Effectively, whichever way you generate a HeliOS program, a typical HeliOS
  50. stand-alone executable comes out at around 250k in size, which includes the
  51. whole of the HeliOS support code.
  52.  
  53. This is obviously quite a large file size, but the files can be packed to
  54. give a typical length of around 100k per single standalone HeliOS program.
  55.  
  56. The use of the overlay system, however, means that you can effectively use
  57. just one standalone HeliOS "executive" program as a 100k "library", which is
  58. used to run any number of tiny HeliOS code modules.
  59.  
  60. Note that the current version of the HeliOS execution software is not
  61. re-entrant, so it cannot be used simultaneously by multiple programs.
  62.  
  63. HeliOS code modules are actually very compact indeed, with extremely large
  64. programs taking less than 50k on average.
  65.  
  66. Using the stand-alone executive program you can have many tiny code modules
  67. which are all run from the main executive, but you will always need at least
  68. 100k (packed) executable overhead to run a standalone HeliOS program.
  69.  
  70. Because of the very complex interlinking of many specialised functional
  71. components within the internal structure of HeliOS, it is impossible to
  72. change the system to generate small "selectively compiled" executables
  73. while retaining the present system efficiency.  The only ways of partly
  74. alleviating this situation involve radical design changes with certain
  75. detrimental effects in other areas of performance.
  76.  
  77. We accept that this is one of the disadvantageous trade-offs of the HeliOS
  78. language, but this has to be offset against the many advantages HeliOS has
  79. over the languages like "C" which can selectively compile code.
  80.  
  81. Ultimately we believe that the many special advantages of HeliOS outweigh
  82. the admitted disadvantage that HeliOS cannot generate stand-alone programs
  83. very small in size.
  84.  
  85. Of course the executable size is really no problem at all from the point of
  86. view of programming larger applications, but small programs generated from
  87. HeliOS will always have an overly large 100k executable overhead.
  88.  
  89. Please let us know your opinions on this matter of executable file size,
  90. and if it proves to be a major problem for a lot of users we will consider
  91. options for changing to a more modular architecture which might offer a
  92. partial solution to the problem.
  93.  
  94. ****************************
  95. Compilation versus execution
  96. ****************************
  97.  
  98. For those who aren't so sure about what this is all about, here is a very
  99. simplistic discussion of the processes of compilation and code execution.
  100.  
  101. If you read the documentation on "Includes" you may still be unsure exactly
  102. how speeds of compilation and execution are affected by various methods of
  103. using symbolic values for numbers in your programs.
  104.  
  105. Beginners may be unclear as to the difference between the processes of
  106. interpretation, compilation and execution, and even Forth "experts" will
  107. not be aware of the unusual way in which HeliOS works internally.
  108.  
  109. This, briefly and simply, is what happens:
  110.  
  111.  
  112. **************
  113. Interpretation
  114. **************
  115.  
  116. The HeliOS system reads your source code, or what you type at the command
  117. line, and interprets its.  In other words it tries to understand it, and
  118. if it cannot do so an error will obviously be reported.  It is here that
  119. HeliOS can make use of the include files for symbol reference.
  120.  
  121.  
  122. ***********
  123. Compilation
  124. ***********
  125.  
  126. Having "understood" the code, HeliOS proceeds to "compile" instructions for
  127. the computer's CPU in a special internal format.  These special compiled
  128. instructions are stored in an internal memory buffer of unlimited size.
  129.  
  130. The process of compilation has quite a lot of work to do as it generates
  131. runnable units of code, and it also has to create a means of accessing this
  132. code via further program instructions.  This is achieved using the HeliOS
  133. "vocabulary" and "dictionary" lists.
  134.  
  135.  
  136. **********
  137. Vocabulary
  138. **********
  139.  
  140. The "name" which you have associated with any particular function will be
  141. stored in a special "quick-look-up" list called the "vocabulary", so that
  142. HeliOS can respond when you use this name in future.  The vocabulary list
  143. is stored separately and is only used by the interpreter.  When you create
  144. a stand-alone program the vocabulary information is not necessary and so
  145. is not included.  This differs from traditional Forth methods.
  146.  
  147.  
  148. **********
  149. Dictionary
  150. **********
  151.  
  152. The HeliOS system uses an internal linkage table which associates
  153. the ASCII vocabulary "names" with the appropriate compiled code.  This is
  154. called the "dictionary", and is limited in size, so it is quite important
  155. to conserve dictionary space.  The dictionary does NOT store the vocabulary
  156. ASCII names themselves in HeliOS, nor does it store the execution code
  157. or "body" of the HeliOS word.  Again, this is totally different from the
  158. way traditional Forths were structured: it must be remembered that HeliOS
  159. is radically different from other Forth-type languages in terms of internal
  160. organisation.
  161.  
  162. Dictionary space should be conserved where possible, but HeliOS has
  163. far fewer constraints than traditional Forth in this respect.  There is a
  164. display of available dictionary space at all times in the HeliOS "status"
  165. display, and you should always keep note of how this changes.
  166.  
  167. The dictionary in HeliOS is the nerve centre which organises all the other
  168. elements of the system: rather like DNA it forms a compact encrypted
  169. informational resource which defines how a program links together various
  170. executable sub-units.  Dictionary space is used in proportion to how many
  171. words you define, rather than by how long the words are, so you can create
  172. HUGE programs which use relatively little dictionary space as long as each
  173. of the program words does not use lots of tiny sub-word definitions.
  174.  
  175.  
  176. *********
  177. Execution
  178. *********
  179.  
  180. Finally, you can "run" the program.  This is called "execution", and merely
  181. involves the pre-compiled code being processed by the CPU.  This is a fast
  182. process since all the hard work has been done during the compilation stage.
  183.  
  184. Please read "StandAlonePrograms.doc" for more information.
  185.  
  186.